Hi, |
Re: How do I Create a list of enumerations used in a module
Here is a script I found in the Net and I am unable to recall the name of its author.
string results = ""
AttrType at
atCount = 0
int tmp = 0, cnt = 0
for at in current Module do
{
if (! at.system)
{
results = results at.name " : " (at.type) "\n\n"
if ((at.type "" == "Enumeration") && (atCount == 0))
{
atCount++
}
atCount = 0
tmp = at.size
for (cnt = 0;cnt < tmp;cnt=(cnt + 1))
{
results = results "\t" cnt " " at.strings[cnt] "\n"
}
results = results "\n"
print results
} //End of if
}
|
Re: How do I Create a list of enumerations used in a module bullbala - Thu Mar 10 07:12:37 EST 2011
Here is a script I found in the Net and I am unable to recall the name of its author.
string results = ""
AttrType at
atCount = 0
int tmp = 0, cnt = 0
for at in current Module do
{
if (! at.system)
{
results = results at.name " : " (at.type) "\n\n"
if ((at.type "" == "Enumeration") && (atCount == 0))
{
atCount++
}
atCount = 0
tmp = at.size
for (cnt = 0;cnt < tmp;cnt=(cnt + 1))
{
results = results "\t" cnt " " at.strings[cnt] "\n"
}
results = results "\n"
print results
} //End of if
}
I am look at finding the values that have actually been assigned against objects as opposed to the list of available enumerators e.g. Obj1 Bob, Jim Obj2 Jim Obj3 Peter, Gary Obj4 Jim Obj5 Bob, Jim The results I want are: 1) Bob, Jim 2) Jim 3) Peter, Gary |
Re: How do I Create a list of enumerations used in a module Stig0498 - Thu Mar 10 09:03:39 EST 2011
I hope this example (again borrowed from the Net and edited) might be what you are looking for :-)
// prevent dxl timeout dialog
pragma runLim, 0
Skip split ( string s, char c )
{
Skip split_string = create
int deb = 0
int i
int index = 0
for ( i=0; i<length(s)-1; i++ )
{
if ( s[i] != c )
continue
put( split_string, index, s[deb:i-1] )
deb = i+1
index += 1
}
if ( s[i] == c )
i--
put ( split_string, index, s[deb:i] )
return split_string
}
string attrVal = null
bool isFirstValue = true
Skip theSplitString = create
string tmp
Object o
// Loop through the current display set.
for o in current Module do
{
attrVal = probeAttr_(o, "Attribute 1")
theSplitString = split ( attrVal, '\n' )
isFirstValue = true
print identifier o " : "
for tmp in theSplitString do
{
if(isFirstValue)
{
isFirstValue = false
print tmp
}
else
print ", " tmp
}
print "\n"
}
delete theSplitString
|
Re: How do I Create a list of enumerations used in a module You can use the "isMember" perm to determine if a particular object has the enumeration set, e.g. if (isMember(obj."MyEnumAttr", "Borneo")) then deal with Borneo object
|
Re: How do I Create a list of enumerations used in a module llandale - Thu Mar 10 14:32:15 EST 2011
I don't think I explained properly what I was trying to do. I am trying to get a list of unigue values / combination of values used in the module. This will not be equal to the number of enumerations. In the example below, the enumerated list is Bob, Jim, Peter, Gary. The list I need to generate is a list of unique permutations used in the module, i.e. 1)Bob, Jim 2) Jim 3) Peter, Gary. All duplicate entries to be ignored Obj1 Bob, Jim Obj2 Jim Obj3 Peter, Gary Obj4 Jim Obj5 Bob, Jim The results I want are: 1) Bob, Jim 2) Jim 3) Peter, Gary |
Re: How do I Create a list of enumerations used in a module Stig0498 - Mon Mar 14 05:20:44 EDT 2011
I think I understand your requirement better now.
// Create list of unique permutations in alphabetical order.
Skip uniquePermutations = createString
Object o
// Loop through the display set of the current module.
for o in current Module do
{
put(uniquePermutations, o."Attribute 1" "", o."Attribute 1" "")
}
string temp
int count = 0
// Loop through the list of unique permutations.
for temp in uniquePermutations do
{
count++
print (count) ")" temp "\n"
}
// Free memory.
delete uniquePermutations
|
Re: How do I Create a list of enumerations used in a module bullbala - Mon Mar 14 05:53:14 EDT 2011
I think I understand your requirement better now.
// Create list of unique permutations in alphabetical order.
Skip uniquePermutations = createString
Object o
// Loop through the display set of the current module.
for o in current Module do
{
put(uniquePermutations, o."Attribute 1" "", o."Attribute 1" "")
}
string temp
int count = 0
// Loop through the list of unique permutations.
for temp in uniquePermutations do
{
count++
print (count) ")" temp "\n"
}
// Free memory.
delete uniquePermutations
|